package cn.jly.spring.annotation.listener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author lanyangji
 * @description 测试主类
 * @date 2020/11/14 上午 11:20
 */
public class MainTest {
    public static void main(String[] args) {
        final AnnotationConfigApplicationContext applicationContext =
                new AnnotationConfigApplicationContext(MainConfigOfListener.class);

        // 利用容器发布自定义事件
        applicationContext.publishEvent(new ApplicationEvent("我发布的事件") {});

        applicationContext.close();
    }
}
